package com.l024.user.shiro;

import com.l024.config.config.utils.JwtUtil;
import org.apache.shiro.authc.AuthenticationToken;

//这个就类似UsernamePasswordToken
public class JwtToken implements AuthenticationToken {

    private String jwt;

    public JwtToken(String jwt) {
        this.jwt = jwt;
    }

    @Override//类似是用户名
    public Object getPrincipal() {
        return new JwtUtil().decode(this.jwt).get("username");
    }

    @Override//类似密码
    public Object getCredentials() {
        return new JwtUtil().decode(this.jwt).get("password");
    }
}